import request from "@/utils/request";

class VideoAPI {
  /** 根据VID查询视频*/
  static getVideoDetail(vid) {
    return request({
      url: `/api/videoSearch/getVideoByVid?vid=${vid}`,
      method: "get",
    });
  }

  /** 根据VID查询视频Statux*/
  static getVideoStatus(vid) {
    return request({
      url: `/api/videoSearch/getVideoStats?vid=${vid}`,
      method: "get",
    });
  }

  /** 根据UID查询视频UP主信息*/
  static getUserInfo(uid) {
    return request({
      url: `/api/videoSearch/getUserInfo?uid=${uid}`,
      method: "get",
    });
  }

  /** 根据uid关注Up主*/
  static followUp(data) {
    return request({
      url: "/follow/add",
      method: "post",
      data,
    });
  }

  /** 添加评论*/
  static addVideoComment(data) {
    return request({
      url: "/comment/addComment",
      method: "post",
      data,
    });
  }

  /** 获取评论*/
  static getVideoComments({ vid, sortChoose, currentCommentPage }) {
    return request({
      url: `/comment/findAllComment?vid=${vid}&sortChoose=${sortChoose}&currentCommentPage=${currentCommentPage}`,
      method: "get",
    });
  }
  /** 删除评论*/
  static deleteVideoComment(data) {
    return request({
      url: `/comment/deleteComment`,
      method: "post",
      data,
    });
  }
  /** 点赞评论*/
  static likeOrDislikeComment(data) {
    return request({
      url: `/comment/likeOrDislikeComment`,
      method: "post",
      data,
    });
  }

  //获取userVideo相关信息，得到当前用户对当前视频的点赞、评论、收藏
  static getUserVideoInfo({ uid, vid }) {
    return request({
      url: `/uservideo/userVideoInfo?uid=${uid}&vid=${vid}`,
      method: "get",
    });
  }
  //点赞、投币、收藏
  static love({ uid, vid }) {
    return request({
      url: `/uservideo/love?uid=${uid}&vid=${vid}&isLove=true&isSet=true`,
      method: "post",
    });
  }
}

export default VideoAPI;
